<template>
  <div>
    <div>维修项目明细</div>
    <div>
      <FilterTable ref="tableP" :columns="columns" :datakey="'rows'" :fetchapi="fetchApi" :params="fetchParams" :onColumnsChange="columns => (this.columns = columns)" :height="250"></FilterTable>
    </div>

    <div>维修备件明细</div>
    <div>
      <FilterTable ref="tableL" :columns="columnL" :datakey="'rows'" :fetchapi="fetchApiL" :params="fetchParams" :onColumnsChange="columnL => (this.columnL = columnL)" :height="250"></FilterTable>
    </div>
  </div>
</template>

<script>
import { searchProject, searchParts } from '@/api/repair/archivesManage/healthQuery/index';
export default {
  name: 'detailed',
  props: ['rowData'],
  data() {
    return {
      columns: this.createTablelist(),
      columnL: this.createTablelist1(),
      fetchApi: searchProject,
      fetchApiL: searchParts,
      fetchParams: {}
    };
  },
  created() {
    this.fetchParams = this.rowData;
    console.log(this.fetchParams);
  },
  methods: {
    createTablelist() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '维修项目',
          dataIndex: 'LABOUR_NAME',
          sorter: true
        },
        {
          title: '维修工时',
          dataIndex: 'STD_LABOUR_HOUR',
          sorter: true
        }
      ];
    },
    createTablelist1() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '备件编码',
          dataIndex: 'PART_NO',
          sorter: true
        },
        {
          title: '备件名称',
          dataIndex: 'PART_NAME',
          sorter: true
        },
        {
          title: '备件数量',
          dataIndex: 'PART_QUANTITY',
          sorter: true
        }
      ];
    }
  }
};
</script>
